package com.kang.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.kang.dao.JurisdictionMapper;
import com.kang.dao.Role_jurisdictionMapper;
import com.kang.pojo.Jurisdiction;
import com.kang.pojo.Role_jurisdiction;
import com.kang.service.JurisdictionService;
import com.vonechina.entity.page.RootPage;

/**
 * 权限服务Impl
 * 
 * @author ysq
 *
 */
@Service
public class JurisdictionServiceImpl implements JurisdictionService {
	/**
	 * 权限JurisdictionMapper
	 */
	@Resource
	private JurisdictionMapper jtm;
	/**
	 * 角色_权限Role_jurisdictionMapper
	 */
	@Resource
	private Role_jurisdictionMapper ro_jm;

	/**
	 * 修改权限jurisdiction数据
	 */
	@Override
	public int updateone(Jurisdiction jsc) {

		return jtm.updateByPrimaryKeySelective(jsc);
	}

	/**
	 * 根据条件查询权限jurisdiction数据list
	 */
	@Override
	public List<Jurisdiction> selstcJurisdiction(RootPage rootPage) {
		rootPage.setRows(jtm.selstcJurisdictioncount(rootPage));// 设置总条数
		return jtm.selstcJurisdiction(rootPage);
	}

	/**
	 * 根据roleid查询角色_权限role_jurisdiction
	 */
	@Override
	public List<Role_jurisdiction> selectRole_jurisdiction(Integer roleid) {

		return jtm.selectRole_jurisdiction(roleid);
	}

	/**
	 * 添加多条角色权限role_jurisdiction
	 */
	@Override
	public int insertones(List<?> list) {

		return ro_jm.insert(list);
	}

	/**
	 * 根据userID查询用户_角色_权限等信息
	 */
	@Override
	public List<Jurisdiction> listUserJurisdiction(Integer userID) {
		return jtm.listUserJurisdiction(userID);
	}

	/**
	 * 根据id删除role_jurisdiction角色-权限表
	 */
	@Override
	public int delectones(Integer roleid) {
		return ro_jm.deleteByPrimaryKey(roleid);
	}

}
